package com.itheima.mapper;

import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

@Mapper
public interface OrderMapper {
    /**
     * 根据预约id查询体检预约信息
     * @param id
     * @return
     */
    @Select("select * from t_order where id = #{id}")
    Order findById(Integer id);

    @Select("select name from t_member where id = #{memberId}")
    String findMemberById(Integer memberId);

    @Insert("insert into t_order (member_id,orderDate,orderType,orderStatus,setmeal_id) values (#{memberId},#{orderDate},#{orderType},#{orderStatus},#{setmealId})")
    void add(Integer memberId, LocalDate orderDate, String orderType, String orderStatus, Integer setmealId);
}
